//
//  JEmoticonsAttachment.swift
//  01-表情键盘
//
//  Created by Jason on 30/5/15.
//  Copyright (c) 2015 Shepherd. All rights reserved.
//

import UIKit

class JEmoticonsAttachment: NSTextAttachment {
   // 表情符号的文本
    var chs : String?
    /**
    工厂方法
    
    :param: emoticons 表情描述
    :param: height    行高
    
    :returns: 内容文字
    */
    class func emoticonString(emoticons:JEmoticons,height:CGFloat) -> NSAttributedString {
        // 创建图片附属的表情文字
        let attachement = JEmoticonsAttachment()
        attachement.image = UIImage(contentsOfFile: emoticons.imgPath!)
        attachement.bounds = CGRectMake(0, -4, height, height)
        attachement.chs = emoticons.chs
        return NSAttributedString(attachment: attachement)
    }
}
